package com.kpmg.datalake.common.controller;

import com.kpmg.datalake.common.model.DimInfo;
import com.kpmg.datalake.common.service.RbacDataService;
import com.kpmg.datalake.common.vo.BaseQueryVO;
import com.kpmg.datalake.common.vo.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Echo
 * @create 2018-07-12
 * @desc
 */

@RestController()
@RequestMapping("/rbac_data")
public class RbacDataController {

    @Autowired
    private RbacDataService rbacDataService;

    @PostMapping("/list")
    public ServerResponse list(@RequestBody BaseQueryVO baseQueryVO) {

        DimInfo dataMenuList = rbacDataService.getDataMenuList(baseQueryVO.getProjectId());

        if (dataMenuList != null) {
            return ServerResponse.createBySuccess("获取实体列表成功！", dataMenuList);
        } else {
            return ServerResponse.createByErrorMessage("获取实体列表失败！");
        }
    }
}
